#include<stdio.h>
#include<math.h>
#include<string.h>

////
//declaration of the functions
int append(int a[],int x,int len)
{
	a[len]=x;
	len=len+1;
	return a,len;
}


int extend_list(int a[],int b[],int len1,int len2)
{
	int i;
	for(i=0;i<=len2-1;i++)
	{
		a,len1=append(a,b[i],len1);
	}
	return a,len1;
}
		

	

int index_list(int a[],int x,int len)
{
	int i,flag=0,l=0;
	for(i=0;i<=len-1;i++)
	{
		if(x==a[i])
		{
			printf("the value is found\n");
			printf("the position of the value is %d",i);
			printf("\n");
			break;
			flag=0;	
		}
		else if(x!=a[i])
		{
			flag=1;
		}
		l=l+flag;
	}
	if(l==len)
	{
		printf("value is not in the list\n");
	}
}




int insert_val(int a[],int x,int pos,int len)
{
	int b[100],i,j;
	for(i=0;i<len;i++)
	{
		b[i]=a[i];
	}
	a[pos]=x;
	len++;
	for(j=pos+1;j<=len;j++)
	{
		a[j]=b[j-1];
	}
	return a,len;
}

